package com.fucius.study.leetcode;

import java.util.*;

public class Solution {

    public static String getRes(int n, int[][] data) {
        // 遍历输出
        int[] res = new int[n];

        Set<Integer> stat = new HashSet();
        for (int i = 0; i < n; i++) {
            stat.add(i+1);
        }

        for (int i = 0; i < n; i++) {
            for (int t : data[i]) {
                if (stat.contains(t)) {
                    res[i] = t;
                    stat.remove(Integer.valueOf(t));
                    break;
                }
            }
        }

        StringJoiner sj = new StringJoiner(" ");

        for (int i = 0; i < n; i++) {
            if (i > 0) {
                sj.add(i+"");
            }
        }
        return sj.toString();
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // 读取 n m
        int n = Integer.valueOf(scanner.nextLine());
        int[][] data = new int[n][n];
        // 读入数组
        for (int i = 0; i < n; i++) {
            String temp = scanner.nextLine();
            String[] arr = temp.split(" ");
            for (int i1 = 0; i1 < arr.length; i1++) {
                data[i][i1] = Integer.valueOf(arr[i1]);
            }
        }
        String res = getRes(n, data);
        System.out.println(res);
    }
    public int test(int num){
        Set<String> set = new HashSet<>();
        new ArrayList(set);
        return Integer.reverseBytes(num);
    }
}

